#pragma once
#include "task_msgs/task_msg.h"
#include "task_msgs/task_path.h"
#include "task_msgs/task_point.h"
#include "task_msgs/work_task.h"

#include "actuator_msgs/actuator_msg.h"
#include "control_msgs/control_msg.h"
#include "control_msgs/control_state_msg.h"

namespace task
{
    struct sWorkTask
    {
        bool is_receive_cmd;
        uint8_t type;
        uint8_t work_id;
        float value;
        bool enable;
        float pose;
        float speed;
        uint8_t control_mode;
        float thresh;
        sWorkTask()
        {
            is_receive_cmd = false;
        }
    };
    struct sTaskPoint
    {
        std::string point_id;
        float x;
        float y;
        float z;
        float theta;
        std::vector<sWorkTask> v_work_task;
        sTaskPoint()
        {
            x = 0.0f;
            y = 0.0f;
            z = 0.0f;
            theta = 0.0f;
            v_work_task.clear();
        }
    };
    struct sTaskPath
    {
        std::string path_id;
        std::string path_type;
        std::string move_direction; // AMR move direction "forward" or "backward"
        uint32_t task_id;
        std::vector<sTaskPoint> v_control_points;
        std::vector<sTaskPoint> v_key_points;
        float max_speed;
        float amr_angle;
        std::string angle_type;
        sTaskPath()
        {
            path_id = "";
            path_type = "";
            move_direction = "";
            angle_type = "";
        }
    };

    struct sTaskReceive
    {
        std::string header;
        std::string command;
        uint32_t SN;
        uint32_t task_id;
        std::string target_id;
        std::string map_id;
        float speed_level;
        std::vector<std::string> point_list;
        std::vector<sWorkTask> work_task;

        sTaskReceive()
        {
            SN = 0;
            task_id = 0;
            map_id = "";
            point_list.clear();
        }
    };

    struct sTaskMsg
    {
        uint32_t task_id;
        std::vector<sTaskPath> v_task_path;
        std::string target_point_id;
    };
 
    struct sAMRState
    {
        std::string amr_type;
        std::string amr_id;
        actuator_msgs::actuator_msg actuator;
        control_msgs::control_msg control;
        control_msgs::control_state_msg control_state;

        sAMRState()
        {
            amr_type = "";
            amr_id   = "";
            control_state.amr_fsm_state = "";
            control_state.amr_task_state = "";
        }
    };
} // namespace task
